package net.hn.hnms.biz.mine.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import lombok.RequiredArgsConstructor;
import net.hn.hnms.biz.api.mine.model.DustIndicatorVo;
import net.hn.hnms.biz.api.mine.model.GasIndicatorVo;
import net.hn.hnms.biz.api.safety.monitor.model.ComprehensiveScore;
import net.hn.hnms.biz.api.safety.monitor.model.FireIndicatorVo;
import net.hn.hnms.biz.api.safety.monitor.model.FloodIndicatorVo;
import net.hn.hnms.biz.mine.config.TableSwitching;
import net.hn.hnms.biz.mine.domain.WateremissionAlarmDayPo;
import net.hn.hnms.biz.mine.domain.dto.WaterDamageWarningInfoPageDto;
import net.hn.hnms.biz.mine.domain.vo.WaterDamageWarningInfoVo;
import net.hn.hnms.biz.mine.mapper.WateremissionAlarmDayMapper;
import net.hn.hnms.biz.mine.service.GasService;
import net.hn.hnms.sys.common.core.constant.Constants;
import net.hn.hnms.sys.common.core.domain.ResponsePage;
import net.hn.hnms.sys.common.core.utils.StringUtils;
import net.hn.hnms.sys.common.mybatis.core.page.PageQuery;
import net.hn.hnms.sys.common.redis.domain.SysOrganization;
import net.hn.hnms.sys.common.redis.utils.RedisUtils;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.math.BigDecimal;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.time.ZoneId;
import java.util.*;
import java.util.stream.Collectors;

/**
 * 智呈物联 pan'sx
 * 2022/9/28 14:53
 * 1.0 version
 */
@Service
@RequiredArgsConstructor
public class GasServiceImpl implements GasService {
    private final JdbcTemplate jdbcTemplate;
    private final TableSwitching tableSwitching;

    //水害预警信息表
    @Resource
    private WateremissionAlarmDayMapper wateremissionAlarmDayMapper;

    @Override
    public GasIndicatorVo gasIndicator(String mineCode) {
        String sql = "SELECT t2.*,t1.indicator_second_level_name,t1.indicator_third_level_name,t1.indicator_weight_value FROM znjc.ssys_indicator t1 join znjc." + tableSwitching.getTableName() + " t2 on \n" +
                "( t1.indicator_first_level_code=t2.indicator_first_level_code\n" +
                " and t1.indicator_second_level_code=t2.indicator_second_level_code\n" +
                " and t1.indicator_third_level_code=t2.indicator_third_level_code and t1.mine_code=t2.mine_code)\n" +
                "where t1.indicator_first_level_code='30' %s and data_time=(select max(data_time) from znjc." + tableSwitching.getTableName() + " where  indicator_first_level_code='30' %s)";

        GasIndicatorVo vo = new GasIndicatorVo();
        vo.setMineName(Constants.mineCodeName.get(mineCode));
        String where = "";
        if (StringUtils.isNotBlank(mineCode)) {
            where = " and mine_code='" + mineCode + "'";
            mineCode = " and t1.mine_code='" + mineCode + "' and t2.mine_code='" + mineCode + "'";

        } else {
            mineCode = "";
        }
        List<Map<String, Object>> maps = jdbcTemplate.queryForList(String.format(sql, mineCode, where));

        Map<String, String> map = new HashMap<>();//记录二级指标权重
        maps.forEach(s -> {
            if (s.get("indicator_third_level_code") == null || "".equals(s.get("indicator_third_level_code"))) {
                map.put(s.get("indicator_second_level_code") + "", s.get("indicator_weight_value") + "");
            }
        });
        maps.forEach(s -> {
            if (s.get("indicator_third_level_code") == null || "".equals(s.get("indicator_third_level_code"))) {
                if ("3001".equals(s.get("indicator_second_level_code"))) {//人的因素
                    vo.setPersonnel(new BigDecimal(s.get("original_value").toString()));

                } else if ("3002".equals(s.get("indicator_second_level_code"))) {//设备因素
                    vo.setDevice(new BigDecimal(s.get("original_value").toString()));
                } else if ("3003".equals(s.get("indicator_second_level_code"))) {//环境因素
                    vo.setEnvironment(new BigDecimal(s.get("original_value").toString()));
                } else if ("3004".equals(s.get("indicator_second_level_code"))) {//管理因素
                    vo.setManage(new BigDecimal(s.get("original_value").toString()));
                }
                vo.setComprehensive(vo.getComprehensive().add(new BigDecimal(s.get("indicator_value").toString())));
            } else {
                vo.setDiagnoses(vo.getDiagnoses() + 1);
                BigDecimal val = new BigDecimal(s.get("original_value").toString());
                if (val.longValue() < 100) {
                    GasIndicatorVo.Problem problem = vo.new Problem();
                    problem.setDeduct(new BigDecimal(100).subtract(val)
                            .multiply(new BigDecimal(s.get("indicator_weight_value") + ""))
                            .multiply(new BigDecimal(map.get(s.get("indicator_second_level_code")) == null ? "1" : map.get(s.get("indicator_second_level_code")))));
                    problem.setName(s.get("indicator_third_level_name") + "");
                    problem.setReason(s.get("judge_reason") + "");
                    vo.getProblems().add(problem);
                }
            }
        });
        return vo;
    }

    @Override
    public FloodIndicatorVo floodIndicator(String mineCode) {
        String sql = "SELECT t2.*,t1.indicator_second_level_name,t1.indicator_third_level_name,t1.indicator_weight_value FROM znjc.ssys_indicator t1 join znjc." + tableSwitching.getTableName() + " t2 on \n" +
                "( t1.indicator_first_level_code=t2.indicator_first_level_code\n" +
                " and t1.indicator_second_level_code=t2.indicator_second_level_code\n" +
                " and t1.indicator_third_level_code=t2.indicator_third_level_code)\n" +
                "where t1.indicator_first_level_code='10' and data_time=(select max(data_time) from znjc." + tableSwitching.getTableName() + " where  indicator_first_level_code='10') %s";
        String where = "";
        if (StringUtils.isNotBlank(mineCode)) {
            where = " and mine_code='" + mineCode + "'";
            mineCode = " and t1.mine_code='" + mineCode + "' and t2.mine_code='" + mineCode + "'";

        } else {
            mineCode = "";
        }
        List<Map<String, Object>> maps = jdbcTemplate.queryForList(String.format(sql, mineCode, where));
        FloodIndicatorVo vo = new FloodIndicatorVo();
        Map<String, String> map = new HashMap<>();
        maps.forEach(s -> {
            if (s.get("indicator_third_level_code") == null || "".equals(s.get("indicator_third_level_code"))) {
                map.put(s.get("indicator_second_level_code") + "", s.get("indicator_weight_value") + "");
            }
        });
        maps.forEach(s -> {
            if (s.get("indicator_third_level_code") == null || "".equals(s.get("indicator_third_level_code"))) {
                if ("1001".equals(s.get("indicator_second_level_code"))) {//人的因素
                    vo.setPersonnel(new BigDecimal(s.get("original_value").toString()));

                } else if ("1002".equals(s.get("indicator_second_level_code"))) {//设备因素
                    vo.setDevice(new BigDecimal(s.get("original_value").toString()));
                } else if ("1003".equals(s.get("indicator_second_level_code"))) {//环境因素
                    vo.setEnvironment(new BigDecimal(s.get("original_value").toString()));
                } else if ("1004".equals(s.get("indicator_second_level_code"))) {//管理因素
                    vo.setManage(new BigDecimal(s.get("original_value").toString()));
                }
                vo.setComprehensive(vo.getComprehensive().add(new BigDecimal(s.get("indicator_value").toString())));
            } else {
                vo.setDiagnoses(vo.getDiagnoses() + 1);
                BigDecimal val = new BigDecimal(s.get("original_value").toString());
                if (val.longValue() < 100) {
                    FloodIndicatorVo.Problem problem = vo.new Problem();
                    problem.setDeduct(new BigDecimal(100).subtract(val)
                            .multiply(new BigDecimal(s.get("indicator_weight_value") + ""))
                            .multiply(new BigDecimal(map.get(s.get("indicator_second_level_code")) == null ? "1" : map.get(s.get("indicator_second_level_code")))));
                    problem.setName(s.get("indicator_third_level_name") + "");
                    problem.setReason(s.get("judge_reason") + "");
                    vo.getProblems().add(problem);
                }
            }
        });
        return vo;
    }

    @Override
    public FireIndicatorVo fireIndicator(String mineCode) {
        String sql = "SELECT t2.*,t1.indicator_second_level_name,t1.indicator_third_level_name,t1.indicator_weight_value FROM znjc.ssys_indicator t1 join znjc." + tableSwitching.getTableName() + " t2 on \n" +
                "( t1.indicator_first_level_code=t2.indicator_first_level_code\n" +
                " and t1.indicator_second_level_code=t2.indicator_second_level_code\n" +
                " and t1.indicator_third_level_code=t2.indicator_third_level_code)\n" +
                "where t1.indicator_first_level_code='20' %s and data_time=(select max(data_time) from znjc." + tableSwitching.getTableName() + " where  indicator_first_level_code='20' %s)";
        String where = "";
        if (StringUtils.isNotBlank(mineCode)) {
            where = " and mine_code='" + mineCode + "'";
            mineCode = " and t1.mine_code='" + mineCode + "' and t2.mine_code='" + mineCode + "'";
        } else {
            mineCode = "";
        }
        List<Map<String, Object>> maps = jdbcTemplate.queryForList(String.format(sql, mineCode, where));
        FireIndicatorVo vo = new FireIndicatorVo();
//        //内因火灾
//        vo.setInternal(new BigDecimal("87.0"));
//        //外因火灾
//        vo.setExternal(new BigDecimal("95.0"));
//        //人员得分
//        vo.setPersonnel(new BigDecimal("93.0"));
//        //安全管理
//        vo.setManage(new BigDecimal("95.0"));
//        //综合得分
//        vo.setComprehensive(new BigDecimal("91.8"));
        maps.forEach(s -> {
            if (s.get("indicator_third_level_code") == null || "".equals(s.get("indicator_third_level_code"))) {
                if ("2001".equals(s.get("indicator_second_level_code"))) {//人的因素
                    vo.setPersonnel(new BigDecimal(s.get("original_value").toString()));

                } else if ("2002".equals(s.get("indicator_second_level_code"))) {//设备因素
                    vo.setInternal(new BigDecimal(s.get("original_value").toString()));
                } else if ("2003".equals(s.get("indicator_second_level_code"))) {//环境因素
                    vo.setExternal(new BigDecimal(s.get("original_value").toString()));
                } else if ("2004".equals(s.get("indicator_second_level_code"))) {//管理因素
                    vo.setManage(new BigDecimal(s.get("original_value").toString()));
                }
                vo.setComprehensive(vo.getComprehensive().add(new BigDecimal(s.get("indicator_value").toString())));
            }
        });
        return vo;
    }

    @Override
    public DustIndicatorVo dustIndicator(String mineCode) {
        String sql = "SELECT t2.*,t1.indicator_second_level_name,t1.indicator_third_level_name,t1.indicator_weight_value FROM znjc.ssys_indicator t1 join znjc." + tableSwitching.getTableName() + " t2 on \n" +
                "( t1.indicator_first_level_code=t2.indicator_first_level_code\n" +
                " and t1.indicator_second_level_code=t2.indicator_second_level_code\n" +
                " and t1.indicator_third_level_code=t2.indicator_third_level_code)\n" +
                "where t1.indicator_first_level_code='40' %s and data_time=(select max(data_time) from znjc." + tableSwitching.getTableName() + " where  indicator_first_level_code='40' %s)";
        String where = "";
        if (StringUtils.isNotBlank(mineCode)) {
            where = " and mine_code='" + mineCode + "'";
            mineCode = " and t1.mine_code='" + mineCode + "' and t2.mine_code='" + mineCode + "'";

        } else {
            mineCode = "";
        }
        List<Map<String, Object>> maps = jdbcTemplate.queryForList(String.format(sql, mineCode, where));

        DustIndicatorVo vo = new DustIndicatorVo();
        Map<String, String> map = new HashMap<>();//记录二级指标权重
        maps.forEach(s -> {
            if (s.get("indicator_third_level_code") == null || "".equals(s.get("indicator_third_level_code"))) {
                map.put(s.get("indicator_second_level_code") + "", s.get("indicator_weight_value") + "");
            }
        });
        maps.forEach(s -> {
            if (s.get("indicator_third_level_code") == null || "".equals(s.get("indicator_third_level_code"))) {
                if ("4001".equals(s.get("indicator_second_level_code"))) {//人的因素
                    vo.setPersonnel(new BigDecimal(s.get("original_value").toString()));

                } else if ("4002".equals(s.get("indicator_second_level_code"))) {//设备因素
                    vo.setDevice(new BigDecimal(s.get("original_value").toString()));
                } else if ("4003".equals(s.get("indicator_second_level_code"))) {//环境因素
                    vo.setEnvironment(new BigDecimal(s.get("original_value").toString()));
                } else if ("4004".equals(s.get("indicator_second_level_code"))) {//管理因素
                    vo.setManage(new BigDecimal(s.get("original_value").toString()));
                }
                vo.setComprehensive(vo.getComprehensive().add(new BigDecimal(s.get("indicator_value").toString())));
            } else {
                vo.setDiagnoses(vo.getDiagnoses() + 1);
                BigDecimal val = new BigDecimal(s.get("original_value").toString());
                if (val.longValue() < 100) {
                    DustIndicatorVo.Problem problem = vo.new Problem();
                    problem.setDeduct(new BigDecimal(100).subtract(val)
                            .multiply(new BigDecimal(s.get("indicator_weight_value") + ""))
                            .multiply(new BigDecimal(map.get(s.get("indicator_second_level_code")) == null ? "1" : map.get(s.get("indicator_second_level_code")))));
                    problem.setName(s.get("indicator_third_level_name") + "");
                    problem.setReason(s.get("judge_reason") + "");
                    vo.getProblems().add(problem);
                }
            }
        });
        return vo;
    }

    @Override
    public ComprehensiveScore score(String mineCode) {
        ComprehensiveScore score = new ComprehensiveScore();
        score.setDust(dustIndicator(mineCode).getComprehensive());
        score.setFire(fireIndicator(mineCode).getComprehensive());
        score.setGas(gasIndicator(mineCode).getComprehensive());
        score.setFlood(floodIndicator(mineCode).getComprehensive());
        score.setBurst(new BigDecimal(100));
        score.setRoof(new BigDecimal(100));
        BigDecimal fire = score.getFire().multiply(new BigDecimal(0.3));
        BigDecimal dust = score.getDust().multiply(new BigDecimal(0.15));
        BigDecimal gas = score.getGas().multiply(new BigDecimal(0.1));
        BigDecimal water = score.getFlood().multiply(new BigDecimal(0.3));
        BigDecimal abs = score.getRoof().multiply(new BigDecimal(0.15));
        score.setTotal(score.getTotal().add(fire).add(dust).add(gas).add(water).add(abs).setScale(2, BigDecimal.ROUND_HALF_UP));
        return score;
    }

    /**
     * 水害报警预警信息（当天）
     *
     * @param mineCode
     * @return
     */
    @Override
    public List<WaterDamageWarningInfoVo> waterDamageWarningInf(String mineCode) {
        // 获取今天的日期
        LocalDate today = LocalDate.now();

        LambdaQueryWrapper<WateremissionAlarmDayPo> lambdaQueryWrapper = new LambdaQueryWrapper<WateremissionAlarmDayPo>();
        lambdaQueryWrapper.eq(StringUtils.isNotBlank(mineCode), WateremissionAlarmDayPo::getMineCode, mineCode);
        //今天的数据时间
        lambdaQueryWrapper.between(WateremissionAlarmDayPo::getSDataTime,
                LocalDateTime.of(today, LocalTime.MIN),
                LocalDateTime.of(today, LocalTime.MAX));
        //type 数据不为5
        lambdaQueryWrapper.ne(WateremissionAlarmDayPo::getAlarmType, "5");
        List<WateremissionAlarmDayPo> wateremissionAlarmDayPos = wateremissionAlarmDayMapper.selectList(lambdaQueryWrapper);
        if (wateremissionAlarmDayPos.isEmpty()) {
            return new ArrayList<>();
        }
        //获取煤矿缓存信息
        SysOrganization sysOrganization = RedisUtils.getCacheObject(Constants.SYS_CODE_KEY + mineCode);

        List<WaterDamageWarningInfoVo> collect = wateremissionAlarmDayPos.stream().map(t -> {
            WaterDamageWarningInfoVo waterDamageWarningInfoVo = new WaterDamageWarningInfoVo();
            //煤矿编码
            waterDamageWarningInfoVo.setMineCode(t.getMineCode());
            //煤矿名称
            waterDamageWarningInfoVo.setMineName(sysOrganization.getOrgName() == null ? "---" : sysOrganization.getOrgName());
            //报警值 监测值
            waterDamageWarningInfoVo.setAlarmValue(t.getSValue());
            //对比值
            waterDamageWarningInfoVo.setContrastValue(t.getFValue());
            //报警时间
            waterDamageWarningInfoVo.setAlarmDataTime(t.getSDataTime());
            //对比时间
            waterDamageWarningInfoVo.setContrastDataTime(t.getFDataTime());
            //分析时间
            waterDamageWarningInfoVo.setAnalyseDataTime(t.getEDataTime());
            //测点编码
            waterDamageWarningInfoVo.setPointCode(t.getPointCode());
            //测点位置
            waterDamageWarningInfoVo.setPointLocation(t.getPointLocation());
            //测点类型
            waterDamageWarningInfoVo.setSensorType("0503".equals(t.getSensorType()) ? "流量" : "---");
            //单位
            waterDamageWarningInfoVo.setUnit("m³/h");

            //描述
            //判断今日涌水减去昨日涌水是否为正
            Boolean isPositive = t.getSValue().compareTo(t.getFValue()) >= 0;
            String isPositiveString = null;
            if (isPositive) {
                isPositiveString = "增加";
            } else {
                isPositiveString = "减少";
            }
            String stringDescribe = "24小时涌水量趋势与昨日相比" + isPositiveString;
            if ("0".equals(t.getAlarmType())) {
                waterDamageWarningInfoVo.setAlarmDescribe(stringDescribe + "20%");
            } else if ("1".equals(t.getAlarmType())) {
                waterDamageWarningInfoVo.setAlarmDescribe(stringDescribe + "30%");
            } else if ("2".equals(t.getAlarmType())) {
                waterDamageWarningInfoVo.setAlarmDescribe(stringDescribe + "40%");
            } else if ("3".equals(t.getAlarmType())) {
                waterDamageWarningInfoVo.setAlarmDescribe(stringDescribe + "50%");
            } else if ("4".equals(t.getAlarmType())) {
                waterDamageWarningInfoVo.setAlarmDescribe(stringDescribe + "60%");
            } else {
                waterDamageWarningInfoVo.setAlarmDescribe("---");
                waterDamageWarningInfoVo.setAlarmType("---");

            }
            //报警类型
            waterDamageWarningInfoVo.setAlarmType(t.getAlarmType());
            return waterDamageWarningInfoVo;

        }).collect(Collectors.toList());

        return collect;
    }

    /**
     * 水害报警预警信息分页查询
     *
     * @param pageQuery
     * @param waterDamageWarningInfoPageDto
     * @return
     */

    @Override
    public ResponsePage<WaterDamageWarningInfoVo> waterDamageWarningInfoPageList(PageQuery pageQuery, WaterDamageWarningInfoPageDto waterDamageWarningInfoPageDto) {

        pageQuery.setPageNum(pageQuery.getPageNum() >= 1 ? pageQuery.getPageNum() * pageQuery.getPageSize() : 0);

        if (waterDamageWarningInfoPageDto.getStartTime() == null) {
            //设置时间一星期前
            waterDamageWarningInfoPageDto.setStartTime(Date.from(LocalDateTime.now().minusDays(7).atZone(ZoneId.systemDefault()).toInstant()));
        }
        if (waterDamageWarningInfoPageDto.getEndTime() == null) {
            waterDamageWarningInfoPageDto.setEndTime(new Date());
        }
        //获取煤矿缓存信息
        SysOrganization sysOrganization = RedisUtils.getCacheObject(Constants.SYS_CODE_KEY + waterDamageWarningInfoPageDto.getMineCode());

        //获取水害预警分页数据
        List<WateremissionAlarmDayPo> wateremissionAlarmDayPos = wateremissionAlarmDayMapper.selectListPage(pageQuery, waterDamageWarningInfoPageDto);
        //分页查询
//        Page<WateremissionAlarmDayPo> page = wateremissionAlarmDayMapper.selectList(
//        List<WateremissionAlarmDayPo> wateremissionAlarmDayPos = wateremissionAlarmDayMapper.selectList(
//
//                new LambdaQueryWrapper<WateremissionAlarmDayPo>()
//                        .eq(StringUtils.isNotBlank(waterDamageWarningInfoPageDto.getMineCode()), WateremissionAlarmDayPo::getMineCode, waterDamageWarningInfoPageDto.getMineCode())
//                        //报警类型
//                        .eq(StringUtils.isNotBlank(waterDamageWarningInfoPageDto.getAlarmType()), WateremissionAlarmDayPo::getAlarmType, waterDamageWarningInfoPageDto.getAlarmType())
//                        //查询时间
//                        .between(WateremissionAlarmDayPo::getSDataTime, waterDamageWarningInfoPageDto.getStartTime(), waterDamageWarningInfoPageDto.getEndTime())
//                        .orderByDesc(WateremissionAlarmDayPo::getSDataTime));
////                        .last("LIMIT " + pageQuery.getPageSize() +" OFFSET " + pageQuery.getPageNum()));

        if (wateremissionAlarmDayPos.isEmpty()) {
            return new ResponsePage<>(new ArrayList(), 0);
        }
        Integer total = wateremissionAlarmDayPos.get(0).getTotal();


        List<WaterDamageWarningInfoVo> result = wateremissionAlarmDayPos.stream().map(t -> {
            WaterDamageWarningInfoVo waterDamageWarningInfoVo = new WaterDamageWarningInfoVo();
            //煤矿编码
            waterDamageWarningInfoVo.setMineCode(t.getMineCode());
            //煤矿名称
            waterDamageWarningInfoVo.setMineName(sysOrganization.getOrgName() == null ? "---" : sysOrganization.getOrgName());
            //报警值 监测值
            waterDamageWarningInfoVo.setAlarmValue(t.getSValue());
            //对比值
            waterDamageWarningInfoVo.setContrastValue(t.getFValue());
            //报警时间
            waterDamageWarningInfoVo.setAlarmDataTime(t.getSDataTime());
            //对比时间
            waterDamageWarningInfoVo.setContrastDataTime(t.getFDataTime());
            //分析时间
            waterDamageWarningInfoVo.setAnalyseDataTime(t.getEDataTime());
            //测点编码
            waterDamageWarningInfoVo.setPointCode(t.getPointCode());
            //测点位置
            waterDamageWarningInfoVo.setPointLocation(t.getPointLocation());
            //测点类型
            waterDamageWarningInfoVo.setSensorType("0503".equals(t.getSensorType()) ? "流量" : "---");
            //单位
            waterDamageWarningInfoVo.setUnit("m³/h");

            //描述
            //判断今日涌水减去昨日涌水是否为正
            Boolean isPositive = t.getSValue().compareTo(t.getFValue()) >= 0;
            String isPositiveString = null;
            if (isPositive) {
                isPositiveString = "增加";
            } else {
                isPositiveString = "减少";
            }
            String stringDescribe = "24小时涌水量趋势与昨日相比" + isPositiveString;
            if ("0".equals(t.getAlarmType())) {
                waterDamageWarningInfoVo.setAlarmDescribe(stringDescribe + "20%");
            } else if ("1".equals(t.getAlarmType())) {
                waterDamageWarningInfoVo.setAlarmDescribe(stringDescribe + "30%");
            } else if ("2".equals(t.getAlarmType())) {
                waterDamageWarningInfoVo.setAlarmDescribe(stringDescribe + "40%");
            } else if ("3".equals(t.getAlarmType())) {
                waterDamageWarningInfoVo.setAlarmDescribe(stringDescribe + "50%");
            } else if ("4".equals(t.getAlarmType())) {
                waterDamageWarningInfoVo.setAlarmDescribe(stringDescribe + "60%");
            } else if ("5".equals(t.getAlarmType())) {
                waterDamageWarningInfoVo.setAlarmDescribe(stringDescribe + "70%");
            } else {
                waterDamageWarningInfoVo.setAlarmDescribe("---");
                waterDamageWarningInfoVo.setAlarmType("---");
            }
            //报警类型
            waterDamageWarningInfoVo.setAlarmType(t.getAlarmType());

            return waterDamageWarningInfoVo;
        }).collect(Collectors.toList());
        return new ResponsePage<>(result, total);
    }

    /**
     * 水害报警预警类型
     *
     * @return
     */
    @Override
    public Map<String, String> waterDamageWarningInfoType() {
        return new HashMap<String, String>() {{
            put("0", "涌水波动20%");
            put("1", "涌水波动30%");
            put("2", "涌水波动40%");
            put("3", "涌水波动50%");
            put("4", "涌水波动60%");
            put("5", "涌水波动70%");
        }};
    }

}
